import Axios from "@/core/Axios";

interface ResponseData<T = any> {
    code: number,
    result: T,
    message: string
}

interface User {
    name: string,
    age: number
}

function getUser<T>() {
    return Axios<ResponseData<T>>('/extend/user').then(res => {
         res.data;
    }).catch(
        error => {
            console.log(error)
        }
    )
}

async function testRequest() {
    const user = await getUser<User>();
    if (user) {
        console.log(user.result.name)
    }
}
testRequest();